package setup

import (
	"context"
	"device_mq_handler/internal/pkg/instance"
	jt808c "device_mq_handler/internal/protocol/jt808/consumer"
	jt808p "device_mq_handler/internal/protocol/jt808/producer"
	"gitee.com/lailonghui/vehicle-supervision-framework/pkg/asserts"
	"gitee.com/lailonghui/vehicle-supervision-framework/pkg/beans"
	"github.com/streadway/amqp"
)

func AmqpInit(ctx context.Context) {
	conn, err := amqp.Dial(instance.GetConfig().Amqp.GetUrl())
	beans.ProvideBean(conn)
	asserts.Nil(err, err)
	jt808c.NewConsumer(ctx, conn)
	jt808p.NewProducer(ctx, conn)
}
